package net.maergaiyun.job;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import net.maergaiyun.service.TrafficService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class TrafficJobHandler {

    @Autowired
    private TrafficService trafficService;

    /**
     * 过期流量包处理
     *
     * @param param
     * @return
     */
    @XxlJob(value = "trafficExpireHandler", init = "init", destroy = "destroy")
    public ReturnT<String> execute(String param) {
        log.info("execute 删除过期流量包任务方法触发成功");
        trafficService.deleteExpireTraffic();
        return ReturnT.SUCCESS;
    }

    private void init() {
        log.info("trafficExpireHandler init >>>");
    }

    private void destroy() {
        log.info("trafficExpireHandler destroy >>>");
    }
}
